const express = require("express");
const router = express.Router();
const sqlFn = require("./mysqlConfig");
const jwt = require("jsonwebtoken");
const config = require("./config")
const Mock = require('mockjs');
let { v4 } = require('uuid');
let data = require('./listData')



/**
 * 登录
 */
router.post("/login", (req, res) => {
    const {
        username,
        password
    } = req.body;
    const sql = "select * from user where username=? and password=?";
    const arr = [username, password]
    sqlFn(sql, arr, result => {
        if (result.length > 0) {
            const token = jwt.sign({
                id: result[0].id,
                username: result[0].username
            }, config.jwtSecret)
            res.status(200).json(token)
        } else {
            res.status(401).json({
                errors: "用户名密码错误"
            })
        }

    })
})

/**
 * 注册
 */
router.post("/register", (req, res) => {
    const {
        username,
        password
    } = req.body;
    const sql = "insert into user values(null,?,?)";
    const arr = [username, password]
    if (username.length > 0 && password.length > 0) {
        sqlFn(sql, arr, result => {
            if (result.affectedRows > 0) {
                res.status(200).json({
                    msg: "注册成功"
                })
            } else {
                res.status(400).json({
                    msg: "注册失败"
                })
            }
        })
    }
})


/**
 * 验证码
 */
router.get('/verifyCode', (req, res) => {
    res.send({
        code: 1,
        num: ~~(Math.random() * (1000000 - 100000) + 100000)
    })
})

/**
 * 投诉建议
 */
router.get('/suggest', (req, res) => {
    let { question, phone, email } = req.query;
    let sql = "insert into suggest values (null,?,?,?)";
    let arr = [question, phone, email];
    if (question.length > 0 && phone.length > 0 && email.length > 0) {
        sqlFn(sql, arr, result => {
            if (result.affectedRows > 0) {
                res.status(200).json({
                    msg: '添加成功',
                    code: 1
                })
            } else {
                res.status(200).json({
                    msg: '添加失败',
                    code: -1
                })
            }
        })
    }
})


/**
 * 我的列表
 */
router.get('/mineList', (req, res) => {
    res.send({
        msg: "success",
        code: 1,
        data
    })
})

/**
 * 房源收藏（收藏）
 */

router.get('/houseCollect', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        code: 1,
        'list|5': [
            {
                id: function () {
                    return v4()
                },
                'imgUrl|1': ['http://iwenwiki.com/api/livable/search/1.jpg',
                    'http://iwenwiki.com/api/livable/search/2.JPG',
                    'http://iwenwiki.com/api/livable/search/3.jpg',
                    'http://iwenwiki.com/api/livable/search/4.JPG',
                    'http://iwenwiki.com/api/livable/search/5.jpg',
                    'http://iwenwiki.com/api/livable/search/6.jpg'],
                // orderTime: new Date().getTime(), //预定时间
                area: function () {
                    return '长安街' + this.tempTitle
                },  //区域
                tempTitle: '@cword(4,6)', //随机中文汉字
                'houseType|1': ['一室一厅', '两室一厅', '三室两厅'], //户型
                distance: '距离5号和平西街5公里',
                'rendType|1': ['整租', '合租'],
                'price|3000-5000': 0
            },
        ]
    }))
})

/**
 * 约看
 */

router.get('/orderLook', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        code: 1,
        'list|3': [
            {
                id: function () {
                    return v4()
                },
                'imgUrl|1': ['http://iwenwiki.com/api/livable/search/1.jpg',
                    'http://iwenwiki.com/api/livable/search/2.JPG',
                    'http://iwenwiki.com/api/livable/search/3.jpg'],
                orderTime: new Date().getTime(), //预定时间
                area: function () {
                    return '长安街' + this.tempTitle
                },  //区域
                tempTitle: '@cword(4,6)', //随机中文汉字
                'houseType|1': ['一室一厅', '两室一厅', '三室两厅'], //户型
                distance: '距离5号和平西街5公里',
                'rendType|1': ['整租', '合租'],
                'price|3000-5000': 0
            },
        ]
    }))
})
/**
 * 办理退租
 */

router.get('/exitRent', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        code: 1,
        list: [
            {
                id: function () {
                    return v4()
                },
                'imgUrl|1': ['http://iwenwiki.com/api/livable/search/1.jpg',
                    'http://iwenwiki.com/api/livable/search/2.JPG',
                    'http://iwenwiki.com/api/livable/search/3.jpg'],
                area: function () {
                    return '长安街' + this.tempTitle
                },  //区域
                tempTitle: '@cword(4,6)', //随机中文汉字
                'houseType|1': ['一室一厅', '两室一厅', '三室两厅'], //户型
                distance: '距离5号和平西街5公里',
                'rendType|1': ['整租', '合租'],
                'price|3000-5000': 0
            },
        ]
    }))
})
/**
 * 首页接口
 */

// 1.首页轮播图接口
router.get('/homeBanner', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        'list': [{
            id: 1,
            url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607331968572&di=0c923acb4830e016b41fa2361ee91c4f&imgtype=0&src=http%3A%2F%2F01imgmini.eastday.com%2Fmobile%2F20200225%2F20200225174827_9a1e8e77a62aecb3a0341a14a9bdecf7_2.jpeg'
        },
        {
            id: 2,
            url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607332776210&di=827435a54377f93dac32da3dfef950e4&imgtype=0&src=http%3A%2F%2Fimg9.doubanio.com%2Fview%2Fgroup_topic%2Fl%2Fpublic%2Fp157489484.jpg'
        },
        {
            id: 3,
            url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607332131065&di=2ff2d07a94a7b30814e7e1a94cdcfeb7&imgtype=0&src=http%3A%2F%2Ffile.digitaling.com%2FeImg%2Fuimages%2F20200204%2Fremote_158079198890814.jpg'
        }
        ]
    }))
})

// 2. 首页房屋信息
router.get('/homeHouse', (req, res) => {
    let page = req.query.page;
    res.send(Mock.mock({
        msg: 'success',
        'list|8': [{
            'id|+1': 123,
            title: '@cword(8,10)',
            'zftype|1': ['整租', '合租', '公寓', '直租'],
            'huxing|1': ['一室一厅', '两室一厅', '三室两厅'],
            'area|50-130.2': 0,
            'tempprice|500-5000': 0,
            price: function () {
                return this.tempprice + '/月'
            },
            'img|1': [
                'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607331968572&di=0c923acb4830e016b41fa2361ee91c4f&imgtype=0&src=http%3A%2F%2F01imgmini.eastday.com%2Fmobile%2F20200225%2F20200225174827_9a1e8e77a62aecb3a0341a14a9bdecf7_2.jpeg',

                'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607332776210&di=827435a54377f93dac32da3dfef950e4&imgtype=0&src=http%3A%2F%2Fimg9.doubanio.com%2Fview%2Fgroup_topic%2Fl%2Fpublic%2Fp157489484.jpg',

                'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607332131065&di=2ff2d07a94a7b30814e7e1a94cdcfeb7&imgtype=0&src=http%3A%2F%2Ffile.digitaling.com%2FeImg%2Fuimages%2F20200204%2Fremote_158079198890814.jpg'
            ]
        }]
    }))
})

// 3.热门城市
router.get('/hotcity', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        'list|9': [{
            'id|+1': 1,
            'city|+1': ['北京市', '上海市', '深圳市', '广州市', '杭州市', '南京市', '苏州市', '成都市', '武汉市']
        }]
    }))
})
// 4.城市名称 
router.get('/allCityName', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        'list': [{
            'id': 1,
            'province': '山西省',
            'cityName': ['太原市', '大同市', '阳泉市', '长治市', '临汾市', '晋中市', '运城市', '忻州市', '朔州市', '吕梁市', '古交市']
        },
        {
            'id': 2,
            'province': '山东省',
            'cityName': ['济南市', '青岛市', '威海市', '潍坊市', '菏泽市', '济宁市', '东营市', '烟台市', '淄博市', '枣庄市', '临沂市']
        },
        {
            'id': 3,
            'province': '甘肃省',
            'cityName': ['兰州市', '白银市', '武威市', '金昌市', '平凉市', '张掖市', '嘉峪关', '酒泉市', '庆阳市', '定西市', '天水市']
        }
        ]
    }))
})

// 5.找舍友
router.get('/roommate', (req, res) => {
    let page = req.query.page;
    res.send(Mock.mock({
        msg: 'success',
        'list|10': [{
            'id|+1': 123,
            title: '@cword(13,20)',
            'have|1': ['有房', '无房'],
            'name|1': ['李云龙', '魏和尚', '段鹏', '楚云飞', '秀琴'],
            'time|8-35': 0,
            upData: function () {
                return this.time + '分钟前更新...'
            },
            'headPic|1': [
                'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1503234260,955806448&fm=26&gp=0.jpg',
                'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4030800935,4292798598&fm=26&gp=0.jpg',
                'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2120404302,1628527059&fm=15&gp=0.jpg',
                'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=171417451,2614566748&fm=26&gp=0.jpg',
                'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=760116908,3200038485&fm=11&gp=0.jpg'
            ],
            'house|1': [
                'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=138053502,3583593226&fm=26&gp=0.jpg',
                'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607425358183&di=403e83292fd4ca83cb6fd01d43993ffa&imgtype=0&src=http%3A%2F%2Fimg.zxzhijia.com%2Fedpic%2Fimage%2F201806%2F20180612153605_17349.jpg',
                'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607425377179&di=3af21a22274852de5d7c3d731429daee&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20180905%2Fad0f924ded404585a88772c8d3f837c4.png',
                'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2864242422,3898503693&fm=15&gp=0.jpg'
            ]
        }]
    }))
})

// 6.宜居社区-好物测评
router.get('/appraisal', (req, res) => {
    let page = req.query.page;
    res.send(Mock.mock({
        msg: 'success',
        'list|10': [{
            'id|+1': 123,
            title: '@cword(8,10)',
            info: '@cword(50,200)',
            'num|923-1999': 0,
            upData: function () {
                return this.num + '人参与讨论'
            },
            'headPic': [
                'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1503234260,955806448&fm=26&gp=0.jpg',
                'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4030800935,4292798598&fm=26&gp=0.jpg',
                'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2120404302,1628527059&fm=15&gp=0.jpg',
                'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=171417451,2614566748&fm=26&gp=0.jpg',
            ]
        }]
    }))
})
// 7.热门搜索
router.get('/hotSearch', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        'list|10': [{
            'id|+1': 1,
            'city|+1': ['回龙观', '望京', '宋家庄', '百子湾', '天通苑', '芍药居', '立水桥', '常营', '来广营', '公寓']
        }]
    }))
})
// 8.房屋具体信息
router.get('/searchHouse', (req, res) => {
    let page = req.query.page;
    res.send(Mock.mock({
        msg: 'success',
        code: 1,
        curpage: page,
        'list|10': [{
            'id|+1': 123,
            title: '@cword(8,10)',
            'cztype|1': ['整租', '合租'],
            'fitment|1': ['精修', '简修'],
            'curFloor|10-32': 0,
            'zongFloor': '@natural(6,32)',
            floorStr: function () {
                return '(共' + this.curFloor + '层)'
            },
            'huxing|1': ['一室一厅', '两室一厅', '三室两厅'],
            'area|50-130.2': 0,
            'tempprice|500-5000': 0,
            price: function () {
                return this.tempprice + '/月'
            },
            'house|1': [
                'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=138053502,3583593226&fm=26&gp=0.jpg',
                'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607425358183&di=403e83292fd4ca83cb6fd01d43993ffa&imgtype=0&src=http%3A%2F%2Fimg.zxzhijia.com%2Fedpic%2Fimage%2F201806%2F20180612153605_17349.jpg',
                'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607425377179&di=3af21a22274852de5d7c3d731429daee&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20180905%2Fad0f924ded404585a88772c8d3f837c4.png',
                'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2864242422,3898503693&fm=15&gp=0.jpg'
            ]
        }]
    }))
});

//获取热销单品（商城）
router.get("/goods/hot_sale", (req, res) => {
    res.send({
        msg: "success",
        code: 1,
        list: [{
            id: 1001,
            title: "储物柜",
            img: "http://localhost:5000/static/image/001.jpg"
        },
        {
            id: 1002,
            title: "照明灯",
            img: "http://localhost:5000/static/image/002.jpg"
        },
        {
            id: 1003,
            title: "抱枕",
            img: "http://localhost:5000/static/image/003.jpg"
        },
        {
            id: 1004,
            title: "镜子",
            img: "http://localhost:5000/static/image/004.jpeg"
        }
        ]
    })
})

// 获取家庭常用（商城）
router.get("/goods/family_com_used", (req, res) => {

    res.send({
        msg: "success",
        code: 1,
        list: [{
            id: 10001,
            title: "落地灯",
            img: "http://localhost:5000/static/image/005.jpg"
        },
        {
            id: 10002,
            title: "置物架",
            img: "http://localhost:5000/static/image/006.jpg"
        },
        {
            id: 10003,
            title: "矮脚凳",
            img: "http://localhost:5000/static/image/007.jpg"
        },
        {
            id: 10004,
            title: "毛巾",
            img: "http://localhost:5000/static/image/008.jpg"
        }
        ]
    })
})
//所有分类（商城）
router.get("/goods/all-classify", (req, res) => {

    res.send({
        msg:"success",
        code:1,
        list:[
            {
                id:101,
                title:"卧室",
                img:"http://localhost:5000/static/image/a.jpeg"
            },
            {
                id:102,
                title:"客厅",
                img:"http://localhost:5000/static/image/b.jpg"
            },
            {
                id:103,
                title:"浴室",
                img:"http://localhost:5000/static/image/c.jpeg"
            },
            {
                id:104,
                title:"厨房",
                img:"http://localhost:5000/static/image/d.jpg"
            },
            {
                id:105,
                title:"餐厅",
                img:"http://localhost:5000/static/image/e.jpg"
            },
            {
                id:106,
                title:"儿童",
                img:"http://localhost:5000/static/image/f.jpg"
            }
        ]
    })
})

//品质生活
router.get("/goods/quality-life", (req, res) => {
    res.send({
        msg:"success",
        code:1,
        list:[
            {
                id:1,
                title:"品质生活",
                img:"http://localhost:5000/static/image/01.jpg"
            },
            {
                id:2,
                title:"品牌特卖",
                img:"http://localhost:5000/static/image/02.jpg"
            },
            {
                id:3,
                title:"超低地价",
                img:"http://localhost:5000/static/image/03.jpg"
            },
            {
                id:4,
                title:"温馨家庭",
                img:"http://localhost:5000/static/image/04.jpg"
            },
            {
                id:5,
                title:"精装入住",
                img:"http://localhost:5000/static/image/05.jpg"
            }
        ]
    })
})
//家用电器
router.get("/goods/household",(req,res) => {
    res.send({
        msg:"success",
        code:1,
        list:[
            {
                id:111,
                title:'电视',
                img:"http://localhost:5000/static/image/aa.jpeg"
            },
            {
                id:222,
                title:'冰箱',
                img:"http://localhost:5000/static/image/bb.jpg"
            },
            {
                id:333,
                title:'洗衣机',
                img:"http://localhost:5000/static/image/cc.jpg"
            },
            {
                id:444,
                title:'空调',
                img:"http://localhost:5000/static/image/dd.jpg"
            }
        ]
    })
}
)
//家用家具
router.get("/goods/furniture",(req,res) => {
    res.send({
        msg:"success",
        code:1,
        list:[
            {
                id:111,
                title:'沙发',
                img:"http://localhost:5000/static/image/ee.jpg"
            },
            {
                id:222,
                title:'桌椅',
                img:"http://localhost:5000/static/image/ff.jpg"
            },
            {
                id:333,
                title:'柜子',
                img:"http://localhost:5000/static/image/gg.jpg"
            },
            {
                id:444,
                title:'照明',
                img:"http://localhost:5000/static/image/hh.jpg"
            }
        ]
    })
}
)

//热门推荐
router.get("/goods/hotTopic",(req,res)=>{
    res.send({
        message:"success",
        code:1,
        list:[
            {
                id:001,
                img:"http://localhost:5000/static/image/11.jpeg",
                name:"雅阁粉系床",
                price:1299

            },
            {
                id:002,
                img:"http://localhost:5000/static/image/22.jpeg",
                name:"简约欧式",
                price:3299

            },
            {
                id:003,
                img:"http://localhost:5000/static/image/33.jpg",
                name:"简约现代",
                price:2999

            },
            {
                id:004,
                img:"http://localhost:5000/static/image/44.jpg",
                name:"温馨舒适",
                price:2299

            },
            {
                id:005,
                img:"http://localhost:5000/static/image/55.jpg",
                name:"可爱童真",
                price:6299

            },
            {
                id:006,
                img:"http://localhost:5000/static/image/66.jpg",
                name:"极致舒适",
                price:11299

            }
        ]
    })
})

//详情页
// router.get("/goods/details",(req,res) => {
//     let id=req.query.id
//     res.send(Mock.mock({
//         msg: 'success',
//         'list|6': [{
//             'id|+1': 1,
//             'name|+1': ['雅阁粉系床', '简约欧式', '简约现代', '温馨舒适', '可爱童真', '极致舒适'],
//             'price|+1':["1299-2999","999-3299","3999-4999","998-2599","2699-4999","2999-4599"],
//             'desc1':'@cword(30,40)',
//             'desc2':'@cword(30,40)'
//         }]
//     }))
// })
    router.get("/goods/details",(req,res) => {
        var id = req.query.id
        if( id==1 ){
            res.send({
                mag:'success',
                code:1,
                list:{
                    name:'雅阁粉系床',
                    price:'1299-2999',
                    desc1:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假',
                    desc2:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假'
                }
            })
        }else if(id==2){
            res.send({
                mag:'success',
                code:1,
                list:{
                    name:'雅阁蓝系床',
                    price:'1399-2999',
                    desc1:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假',
                    desc2:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假'
                }
            })
        }else if(id==3){
            res.send({
                mag:'success',
                code:1,
                list:{
                    name:'雅阁灰系床',
                    price:'1299-2999',
                    desc1:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假',
                    desc2:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假'
                }
            })
        }else if(id==4){
            res.send({
                mag:'success',
                code:1,
                list:{
                    name:'雅阁紫系床',
                    price:'1299-2999',
                    desc1:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假',
                    desc2:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假'
                }
            })
        }
        else if(id==5){
            res.send({
                mag:'success',
                code:1,
                list:{
                    name:'雅阁绿系床',
                    price:'1299-2999',
                    desc1:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假',
                    desc2:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假'
                }
            })
        }else if(id==6){
            res.send({
                mag:'success',
                code:1,
                list:{
                    name:'雅阁黄系床',
                    price:'1299-2999',
                    desc1:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假',
                    desc2:'从东南西北高蛋白春回大地农村的环境三顺奶茶过得要死不活度假'
                }
            })
        }
    })


//卧室分类详情
router.get("/goods/bedroom", (req, res) => {

    var id = req.query.id;
    if( id == 101 ){
        res.send({
            msg:'success',
            code:1,
            list:[{
                id:15,
                title: '双人床',
            img:"http://localhost:5000/static/image/bed.jpg",

                data:[{
                    id:18,
                    title:"双人床莱尔维克",
                    type:"床架",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/bed1.jpg",
                },{
                    id:19,
                    title:"双人床提塞尔",
                    type:"床架",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/bed1.jpg",
                },{
                    id:20,
                    title:"双人床科帕达",
                    type:"床架",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/bed1.jpg",
                }]
            },{
                id:16,
                title:'单人床',
                data:[{  
                    id:21,
                    title:"单人床汉尼斯",
                    type:"床架",
                    money:"1699.00",
                    img:"http://localhost:5000/static/image/bed1.jpg",
                },{
                    id:22,
                    title:"单人床提塞尔",
                    type:"床架",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/bed1.jpg",
                },{
                    id:23,
                    title:"单人床科帕达",
                    type:"床架",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/bed1.jpg",
                }]
            },{
                id:17,
                title:'抽屉柜',
                data:[{
                    id:24,
                    title:"抽屉柜莱尔维克",
                    type:"柜子",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                },{
                    id:25,
                    title:"抽屉柜提塞尔",
                    type:"柜子",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                },{
                    id:26,
                    title:"抽屉柜科帕达",
                    type:"柜子",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                }]
            }]
        })
    }else if(id == 102){
        res.send({
            msg:'success',
            code:1,
            list:[{
                id:15,
                title: '客厅',
                img:"http://localhost:5000/static/image/sofa1.jpg",
                data:[{
                    id:18,
                    title:"客厅莱尔维克",
                    type:"床架",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/sofa.jpg",
                },{
                    id:19,
                    title:"客厅提塞尔",
                    type:"床架",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/sofa.jpg",
                },{
                    id:20,  
                    title:"客厅科帕达",
                    type:"床架",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/sofa.jpg",
                }]
            },{
                id:16,
                title:'客厅单人床',
                data:[{
                    id:21,
                    title:"客厅汉尼斯",
                    type:"床架",
                    money:"1699.00",
                    img:"http://localhost:5000/static/image/bed.jpg",
                },{
                    id:22,
                    title:"客厅提塞尔",
                    type:"床架",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/bed.jpg",
                },{
                    id:23,
                    title:"客厅科帕达",
                    type:"床架",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/bed.jpg",
                }]
            },{
                id:17,
                title:'客厅抽屉柜',
                data:[{
                    id:24,
                    title:"客厅莱尔维克",
                    type:"柜子",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                },{
                    id:25,
                    title:"客厅提塞尔",
                    type:"柜子",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                },{
                    id:26,
                    title:"客厅科帕达",
                    type:"柜子",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                }]
            }]
        })
    }else if(id == 103){
        res.send({
            msg:'success',
            code:1,
            list:[{
                id:15,
                title: '浴室',
                img:'http://localhost:5000/static/image/bath1.jpg',
                data:[{
                    id:18,
                    title:"浴室莱尔维克",
                    type:"浴室",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/bath.jpg",
                },{
                    id:19,
                    title:"浴室提塞尔",
                    type:"浴室",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/bath.jpg",
                },{
                    id:20,
                    title:"浴室厅科帕达",
                    type:"浴室",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/bath.jpg",
                }]
            },{
                id:16,
                title:'浴室',
                data:[{
                    id:21,
                    title:"浴室汉尼斯",
                    type:"浴室",
                    money:"1699.00",
                    img:"http://localhost:5000/static/image/bath.jpg",
                },{
                    id:22,
                    title:"浴室提塞尔",
                    type:"浴室",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/bath.jpg",
                },{
                    id:23,
                    title:"浴室科帕达",
                    type:"浴室",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/bath.jpg",
                }]
            },{
                id:17,
                title:'浴室抽屉柜',
                data:[{
                    id:24,
                    title:"浴室莱尔维克",
                    type:"浴室",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                },{
                    id:25,
                    title:"浴室提塞尔",
                    type:"浴室",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                },{
                    id:26,
                    title:"浴室科帕达",
                    type:"浴室",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/chest.jpg",
                }]
            }]
        })
    }else if(id == 104){
        res.send({
            msg:'success',
            code:1,
            list:[{
                id:15,
                title: '厨房',
                img:'http://localhost:5000/static/image/chiken1.jpg',
                data:[{
                    id:18,
                    title:"厨房尔维克",
                    type:"厨房1",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                },{
                    id:19,
                    title:"厨房塞尔",
                    type:"厨房1",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                },{
                    id:20,
                    title:"厨房科帕达",
                    type:"厨房1",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                }]
            },{
                id:16,
                title:'厨房2',
                data:[{
                    id:21,
                    title:"厨房2汉尼斯",
                    type:"厨房2",
                    money:"1699.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                },{
                    id:22,
                    title:"厨房2提塞尔",
                    type:"厨房2",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                },{
                    id:23,
                    title:"厨房2科帕达",
                    type:"厨房2",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                }]
            },{
                id:17,
                title:'厨房3',
                data:[{
                    id:24,
                    title:"厨房3莱尔维克",
                    type:"厨房3",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                },{
                    id:25,
                    title:"厨房3提塞尔",
                    type:"厨房3",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                },{
                    id:26,
                    title:"厨房3科帕达",
                    type:"厨房3",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/chiken.jpg",
                }]
            }]
        })
    }else if(id == 105){
        res.send({
            msg:'success',
            code:1,
            list:[{
                id:15,
                title: '餐厅',
                img:'http://localhost:5000/static/image/lunch1.jpg',
                data:[{
                    id:18,
                    title:"餐厅1",
                    type:"餐厅1",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                },{
                    id:19,
                    title:"餐厅2",
                    type:"餐厅2",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                },{
                    id:20,
                    title:"餐厅3",
                    type:"餐厅3",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                }]
            },{
                id:16,
                title:'餐厅4',
                data:[{
                    id:21,
                    title:"餐厅4",
                    type:"餐厅4",
                    money:"1699.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                },{
                    id:22,
                    title:"餐厅5",
                    type:"餐厅5",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                },{
                    id:23,
                    title:"餐厅6",
                    type:"餐厅6",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                }]
            },{
                id:17,
                title:'餐厅7',
                data:[{
                    id:24,
                    title:"餐厅7",
                    type:"餐厅7",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/lunch.jpgg",
                },{
                    id:25,
                    title:"餐厅8",
                    type:"餐厅8",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                },{
                    id:26,
                    title:"餐厅9",
                    type:"餐厅9",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/lunch.jpg",
                }]
            }]
        })
    }else if(id == 106){
        res.send({
            msg:'success',
            code:1,
            img:"http://localhost:5000/static/image/baby.jpeg",
            list:[{
                id:15,
                title: '儿童1',
                img:'http://localhost:5000/static/image/baby1.jpg',
                data:[{
                    id:18,
                    title:"儿童1",
                    type:"儿童1",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                },{
                    id:19,
                    title:"儿童2",
                    type:"儿童2",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                },{
                    id:20,
                    title:"儿童3",
                    type:"儿童3",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                }]
            },{
                id:16,
                title:'儿童4',
                img:'http://localhost:5000/static/image/baby1.jpg',
                data:[{
                    id:21,
                    title:"儿童5",
                    type:"儿童5",
                    money:"1699.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                },{
                    id:22,
                    title:"儿童6",
                    type:"儿童6",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                },{
                    id:23,
                    title:"儿童7",
                    type:"儿童7",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                }]
            },{
                id:17,
                title:'儿童8',
                img:'http://localhost:5000/static/image/baby1.jpg',
                data:[{
                    id:24,
                    title:"儿童9",
                    type:"儿童9",
                    money:"949.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                },{
                    id:25,
                    title:"儿童10",
                    type:"儿童10",
                    money:"2799.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                },{
                    id:26,
                    title:"儿童11",
                    type:"儿童11",
                    money:"799.00",
                    img:"http://localhost:5000/static/image/baby1.jpg",
                }]
            }]
        })
    }
    
    
})

/**
 * 卧室储物
 */
    router.get("/goods/roomStorage",(req,res) => {
        let type=req.query.type
        if(type == "销量优先"){
            res.send(Mock.mock({
                mag:'success',
                code:1,
                "list|8":[{
                    'img|+1':['http://localhost:5000/static/image/bed.jpg',
                    'http://localhost:5000/static/image/bed1.jpg',
                    'http://localhost:5000/static/image/bed1.jpg',
                    'http://localhost:5000/static/image/bed.jpg',
                    'http://localhost:5000/static/image/bed.jpg',
                    'http://localhost:5000/static/image/bed1.jpg',
                    'http://localhost:5000/static/image/bed1.jpg',
                    'http://localhost:5000/static/image/bed.jpg'
                ],
                    'title|+1':'@cword(4,7)',
                    'desc|+1':'@cword(20,30)',
                    'price|2000-3000':0
                }]
            }))  
        }else if(type == "价格高低"){
            res.send(Mock.mock({
                mag:'success',
                code:1,
                "list|8":[{
                    'img|+1':['http://localhost:5000/static/image/sofa.jpg',
                    'http://localhost:5000/static/image/sofa1.jpg',
                    'http://localhost:5000/static/image/sofa1.jpg',
                    'http://localhost:5000/static/image/sofa.jpg',
                    'http://localhost:5000/static/image/sofa.jpg',
                    'http://localhost:5000/static/image/sofa1.jpg',
                    'http://localhost:5000/static/image/sofa1.jpg',
                    'http://localhost:5000/static/image/sofa.jpg'
                ],
                    'title|+1':'@cword(4,7)',
                    'desc|+1':'@cword(20,30)',
                    'price|2000-3000':0
                }]
            }))  
        }else if(type == "综合排序"){
            res.send(Mock.mock({
                mag:'success',
                code:1,
                "list|8":[{
                    'img|+1':['http://localhost:5000/static/image/baby.jpg',
                    'http://localhost:5000/static/image/baby1.jpg',
                    'http://localhost:5000/static/image/baby1.jpg',
                    'http://localhost:5000/static/image/baby.jpg',
                    'http://localhost:5000/static/image/baby.jpg',
                    'http://localhost:5000/static/image/baby1.jpg',
                    'http://localhost:5000/static/image/baby1.jpg',
                    'http://localhost:5000/static/image/baby.jpg'
                ],
                    'title|+1':'@cword(4,7)',
                    'desc|+1':'@cword(20,30)',
                    'price|2000-3000':0
                }]
            }))  
        }
         
    })














module.exports = router;